'''
Created on Oct 16, 2014

@author: Juan C. Espinoza
@contact: juan.espinoza@jro.igp.gob.pe
'''

import os
from glob import glob
from lisn_utils import AttrDict
        
def get_news(n=3):
    '''
    Return dict with news from file '/data/news.dat'
    '''
    ret = []
    fo = open('/data/news.dat')
    for line in fo:
        if line.strip()=='': continue
        val = line.split('|')
        ret.append(AttrDict({'title':val[0].strip(), 
                             'text':val[1].strip(),
                             'url':val[2].strip(),
                             }))
    return ret[:n]
